package com.yiyuan.app.controller;

import com.guaike.core.entity.param.Page;
import com.guaike.core.entity.result.PageEntity;
import com.guaike.core.entity.result.Result;
import com.yiyuan.app.entity.param.ModifyUserInfoDTO;
import com.yiyuan.app.entity.param.RedeemDTO;
import com.yiyuan.app.service.MineService;
import com.yiyuan.app.entity.result.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

@RestController
@RequestMapping("/mine")
@Api(tags = "我的相关接口组")
@AllArgsConstructor
public class MineController {

    private final MineService mineService;

    @GetMapping("/userInfo")
    @ApiOperation(value = "我的页面信息")
    public Result<MineVO> userInfo() {
        return mineService.userInfo();
    }

    @GetMapping("/getEditNickNamePinecone")
    @ApiOperation(value = "获取修改昵称所需松果")
    public Result<Integer> getEditNickNamePinecone() {
        return Result.success().data(10000).build();
    }

    @GetMapping("/findMyPinecone")
    @ApiOperation(value = "获取我的松果数量")
    public Result<MyPineDataVO> findMyPinecone() {
        return mineService.findMyPinecone();
    }

    @GetMapping("/pineRecordPage")
    @ApiOperation(value = "松树结果记录列表")
    public Result<PageEntity<PineRecordVO>> pineRecordPage(@Valid Page param) {
        return mineService.pineRecordPage(param);
    }

    @GetMapping("/pineInfo")
    @ApiOperation(value = "松树页面信息")
    public Result<PineVO> pineInfo() {
        return mineService.pineInfo();
    }

    @PostMapping("/getPinePrize")
    @ApiOperation(value = "领取松树奖励")
    public Result<Boolean> getPinePrize() {
        return mineService.getPinePrize();
    }

    @GetMapping("/redeemPineconeInfo")
    @ApiOperation(value = "获取松子兑换松果页面信息")
    public Result<RedeemPineconeVO> redeemPineconeInfo() {
        return mineService.redeemPineconeInfo();
    }

    @PostMapping("/redeemPinecone")
    @ApiOperation(value = "松子兑换松果")
    public Result<Boolean> redeemPinecone(@RequestBody @Valid RedeemDTO param) {
        return mineService.redeemPinecone(param);
    }

    @PostMapping("/modifyNickName")
    @ApiOperation(value = "修改昵称")
    public Result<Boolean> modifyNickName(@RequestBody @Valid ModifyUserInfoDTO param) {
        return mineService.modifyNickName(param);
    }

    @GetMapping("/articleInfo")
    @ApiOperation(value = "文档信息")
    public Result<List<ArticleVO>> articleInfo(@ApiParam(value = "文章类型（1：服务协议，2：隐私协议，3：邀请规则，4：松树规则，5：推币机规则，6：街机规则，7：娱乐规则，8：会员说明，9：畅玩规则，10：挂机规则，11：松果榜，12：豪气榜，13：推币高手榜，14：潮玩达人榜，100：注意事项，101：系统公告）", required = true) @RequestParam("articleType") Integer articleType) {
        return mineService.articleInfo(articleType);
    }
}
